<template>
  <el-config-provider :size="size">
    <el-container>
      <el-container>
        <el-aside style="overflow: hidden; border-top: 1px solid #363637" width="256px">
          <div style="width: 256px; height: 60px; border-bottom: 1px solid #363637">
            <el-image src="/down.png"/>
          </div>
          <aside-menu :menus="menus"/>
        </el-aside>
        <el-container style="border-top: 1px solid #363637; border-left: 1px solid #363637">
          <el-header style="border-bottom: 1px solid #363637;">
            <div style="height: 60px; display: flex; align-items: center; justify-content: flex-end;">
              <el-dropdown>
                <el-avatar :size="40" src="/src/assets/imgs/avatar.png"/>
                <template #dropdown>
                  <el-dropdown-menu>
                    <el-dropdown-item>个人资料</el-dropdown-item>
                    <el-dropdown-item divided @click="click">退出</el-dropdown-item>
                  </el-dropdown-menu>
                </template>
              </el-dropdown>
            </div>
          </el-header>
          <el-main>
            <router-view/>
            <!--<el-backtop :visibility-height="0" target=".jeesdp-content"/>-->
          </el-main>
          <el-footer style="height: 38px; line-height: 38px; text-align: center; border-top: 1px solid #363637">JEESDP
          </el-footer>
        </el-container>
      </el-container>
    </el-container>
  </el-config-provider>
</template>
<script lang="js" setup>

import {getCurrentInstance, reactive, ref} from "vue";
import api from "/@//api";

const size = ref('default');
const {proxy} = getCurrentInstance();
const menus = reactive([{
  id: 'home',
  label: "首页",
  name: "home",
  path: "/home",
  type: 'menu',
  icon: null,
}]);

api.menu.getMenus().then(response => {
  if (response.status === 200) {
    menus.push(...response.data);
  }
})

const click = () => {
  api.user.logout();
}
</script>

<style scoped>
.el-backtop {
  z-index: 21;
}

.el-container, .el-main {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow: hidden;
}

.el-tabs {
  height: 100%;
}
</style>
